package com.nstar.pim.view
{
	import com.sina.microblog.MicroBlog;
	import com.sina.microblog.events.MicroBlogErrorEvent;
	import com.sina.microblog.events.MicroBlogEvent;
	
	public class WeiboAPIImpl
	{
		public static var microBlog:MicroBlog;
		
		public function WeiboAPIImpl()
		{
		}
		//获取当前登录用户的UID
		public static function getUID():void{
			microBlog.callWeiboAPI("2/account/get_uid",
				null,"GET",MicroBlogEvent.VERIFY_CREDENTIALS_RESULT,MicroBlogErrorEvent.VERIFY_CREDENTIALS_ERROR);
		}
		
		//查看某用户信息
		public static function loadUser(userId:String):void{
			microBlog.callWeiboAPI("2/users/show",
				{uid:userId},"GET",MicroBlogEvent.LOAD_USER_INFO_RESULT,MicroBlogErrorEvent.LOAD_USER_INFO_ERROR);
		}
		
		//关注某用户
		public static function follow(userId:String):void{
			microBlog.callWeiboAPI("2/friendships/create",
				{uid:userId},"GET",MicroBlogEvent.FOLLOW_RESULT,MicroBlogErrorEvent.FOLLOW_ERROR);
		}		
	}
}